#include "cardOnShowQLabel.h"
#include <vector>
#include "card.h"
#include "labeledCard.h"

CardOnShowQLabel::CardOnShowQLabel(QWidget* par,const std::vector<Card>& x):QLabel(par){
    setGeometry(width/2-(cardWidth/2*(x.size()+1))/2,paddingTop,cardWidth/2*(x.size()+1),cardHeight);

    for(int i=0;i<(int)x.size();i++){
        QLabel* shown=new QLabel(this);
        shown->setGeometry(cardWidth/2*i,0,cardWidth,cardHeight);
        shown->setStyleSheet("background-color:rgba(255,255,255,1);font-size:40px;"
                            "vertical-align:top;text-align:left;border-color:rgba(0,0,0,1);"
                            "border-radius:5px;border-width:2px;border-style: solid;");
        shown->setText(x[i].getShowed().data());
        cards.push_back(shown);
        shown->show();
    }
    show();
}

CardOnShowQLabel::~CardOnShowQLabel(){
    for(auto i:cards)
        delete i;
}
